<?php

class Client
{
	static function IP()
	{
		if(array_key_exists('REMOTE_ADDR', $_SERVER))
			return $_SERVER['REMOTE_ADDR']; 
		return FALSE;
	}
	static function OS()
	{
		if(stripos($_SERVER['HTTP_USER_AGENT'], 'windows') !== FALSE)
			return 'windows';
		if(stripos($_SERVER['HTTP_USER_AGENT'], 'linux') !== FALSE)
			return 'linux';
		if(stripos($_SERVER['HTTP_USER_AGENT'], 'Mac_PowerPC') !== FALSE)
			return 'mac';
	}
	static function Browser()
	{
		if(stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE)
			return 'ie';
		if(stripos($_SERVER['HTTP_USER_AGENT'], 'firefox') !== FALSE)
			return 'firefox';
		if(stripos($_SERVER['HTTP_USER_AGENT'], 'opera') !== FALSE)
			return 'opera';
		if(stripos($_SERVER['HTTP_USER_AGENT'], 'safari') !== FALSE)
			return 'safari';
		
	}
	static function Is($os_browser)
	{
		$arr = explode(' ', $os_browser);
		if(sizeof($arr) == 1)
			return (Client::OS() == $arr[0]);
		return ((Client::OS() == $arr[0]) && (Client::Browser() == $arr[1]));		
	}
}	
?>